<?php
/**
 * Minhlog 分类边栏视图助手
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 *
 * @category   View_Helper
 * @package    Frontend
 * @copyright  Copyright (c) 2009-2010 Minh.Shu Minh.Shu@gmail.com
 * @license    New BSD License
 * @author     Minh.Shu
 * @version    $Id: HottestSideBar.php 2 2010-01-17 13:49:08Z Minh.Shu $
 * @uses viewHelper Zend_View_Helper
 */

class Zend_View_Helper_HottestSideBar extends Minh_View_Helper_SideBarAbstract
{
    public function hottestSideBar ($num = 8)
    {
        $cacheId = md5('hottestSideBar');
        if (! ($hottestSideBarCache = $this->cache->load($cacheId))) {
            $hottestSideBar = array();
            $articleModel = new Domain_Model_Article();
            $hottestSideBar = $articleModel->getArticleByClick($num);
            if(null === $hottestSideBar){
                $hottestSideBar = array();
            } else {
                $this->cache->save($hottestSideBar, $cacheId);
            }
        } else {
            $hottestSideBar = $hottestSideBarCache;
        }
        return $hottestSideBar;
    }
}